/*
 * @Author: your name
 * @Date: 2022-03-29 22:39:39
 * @LastEditTime: 2022-04-28 17:15:05
 * @LastEditors: Please set LastEditors
 * @Description: 用户 入口文件
 * @FilePath: \blog-api\src\user\user.module.ts
 */
import { Module } from '@nestjs/common';
import { UserService } from './user.service';
import { UserController } from './user.controller';
import { TypeOrmModule } from '@nestjs/typeorm';
import { User } from './entities/user.entity';
import { PassportModule } from '@nestjs/passport';
import { LocalStorage } from './entities/local.strategy';
import { JwtModule } from '@nestjs/jwt';
import { jwtConstants } from './entities/jwt.contants';

@Module({
  imports: [ TypeOrmModule.forFeature([User]), PassportModule, JwtModule.register({
      //生成token的key
      secret: jwtConstants.secret,
      // signOption可以在JwtModule设定
      // 或是在createToken时候设定
      signOptions: {
        //token的有效时长
        expiresIn: '12h',
      }
    })
  ],
  controllers: [ UserController ],
  providers: [ UserService, LocalStorage ],
  exports: [ UserService ]
})
export class AdminUserModule {}
